<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<style type="text/css">
.selectWidth2 {
	width: 211px;
}

.selectWidth1 {
	width: 298px;
}
</style>
<x:parse xml="${param.xmlstr}" var="xmlData" />
<table class="t_css" width="100%" border="0" cellpadding="0"
	id="basicInfo" cellspacing="1">
	<tr>
		<td colspan="6" class="t_bar">&nbsp;项目基本信息</td>
	</tr>
	<tr>
		<td nowrap width="20%" align="right"><span class="color_red">*</span>项目名称：</td>
		<td nowrap colspan="5"><input id="zh_title"
			name="proposal/zh_title" label="项目名称" type="text" maxlength="50"
			class="input_css required" style="width: 740px;" 
			value="<x:out select="$xmlData/data/proposal/zh_title" />" /></td>
	</tr>
	<tr>
		<td nowrap align="right" width="20%"><span class="color_red">*</span>申报日期：</td>
		<td nowrap colspan="5">
		    <c:set var="submit_date">
			    <x:out select="$xmlData/data/proposal/submit_date" />
			</c:set> 
			    <cpt:date id="submit_date" name="proposal/submit_date"
				value="${submit_date}" size="33" className="required date"
				label="申报日期"></cpt:date>
		&nbsp;</td>	
	</tr>
   <tr>
		<td nowrap width="10%" align="right"><span class="color_red">*</span>项目举办地点：</td>
		<td nowrap colspan="5"><input id="zh_title"
			name="proposal/address" label="项目举办地点" type="text" maxlength="50"
			class="input_css required" style="width: 740px;" 
			value="<x:out select="$xmlData/data/proposal/address" />" /></td>
	</tr>
    <tr>
		<td nowrap align="right" width="20%"><span class="color_red">*</span>项目开始日期：</td>
		<td nowrap width="20%" ><c:set var="start_date">
				<x:out select="$xmlData/data/proposal/start_date" />
			</c:set> <cpt:date id="start_date" name="proposal/start_date"
				value="${start_date}" size="33"
				className="required date  dateCompare:end_date" label="项目开始日期"></cpt:date>

		</td>
		<td nowrap align="right" width="10%" ><span class="color_red">*</span>项目结束日期：</td>
		<td nowrap width="50%" colspan="3"><c:set var="end_date">
				<x:out select="$xmlData/data/proposal/end_date" />
			</c:set> <cpt:date id="end_date" name="proposal/end_date"
				className="required date" label="项目结束日期" size="33"
				value="${end_date}"></cpt:date></td>
	</tr>
	 <tr>
		<td nowrap width="20%" align="right"><span class="color_red">*</span>主办单位：</td>
		<td nowrap colspan="5"><input 
			name="proposal/host_unit" label="主办单位" type="text" maxlength="50"
			class="input_css required" style="width: 740px;" 
			value="<x:out select="$xmlData/data/proposal/host_unit" />" /></td>
	</tr>
	<tr>
		<td nowrap width="20%" align="right"><span class="color_red">*</span>协办单位：</td>
		<td nowrap colspan="5"><input 
			name="proposal/joint_unit" label="协办单位" type="text" maxlength="50"
			class="input_css required" style="width: 740px;" 
			value="<x:out select="$xmlData/data/proposal/joint_unit" />" /></td>
	</tr>
	<tr>
		<td nowrap width="20%" align="right"><span class="color_red">*</span>承办单位：</td>
		<td nowrap colspan="5"><input 
			name="proposal/organizer" label="承办单位" type="text" maxlength="50"
			class="input_css required" style="width: 740px;" 
			value="<x:out select="$xmlData/data/proposal/organizer" />" /></td>
	</tr>
	<tr>
		<td nowrap width="20%" align="right"><span class="color_red">*</span>举办活动的依据：</td>
		<td nowrap colspan="5"><input 
			name="proposal/activity_basis" label="举办活动的依据" type="text" maxlength="50"
			class="input_css required" style="width: 740px;" 
			value="<x:out select="$xmlData/data/proposal/activity_basis" />" /></td>
	</tr>
	<tr>
		<td nowrap width="20%" align="right"><span class="color_red">*</span>活动审批单位：</td>
		<td nowrap colspan="3"><input 
			name="proposal/activities_unit" label="活动审批单位" type="text" maxlength="50"
			class="input_css required" style="width: 400px;" 
			value="<x:out select="$xmlData/data/proposal/activities_unit" />" /></td>
			<td align="right" width="20%" nowrap ><span class="color_red">*</span>申报单位参与人数：</td>
		    <td width="20%"><input name="proposal/unit_people"  type="text"  
			class="input_text required" label="申报单位参与人数"  style="text-align:right" onfocus="InitInput.setNumber(this,7,0,0)"
			value="<x:out select="$xmlData/data/proposal/unit_people" />" />人
	</tr>
	
	<tr>
  		 <td nowrap align="right"><span class="color_red">*</span>参与方式：</td>
		<td nowrap >
			<c:set var="attendway"><x:out select="$xmlData/data/proposal/attendway_value" /></c:set>
			<cpt:select id="attendway"  key="attendway"  className="select_width" value="${attendway}" ></cpt:select>
			<input type="hidden" id="attendway_value" name="proposal/attendway_value" class="required" value="${attendway}" label="参与方式">
			<input type="hidden" name="proposal/attendway_name" value="<x:out select="$xmlData/data/proposal/attendway_name" />">
		</td>

		<td nowrap="nowrap" align="right" colspan="2"><span class="color_red" id="need_req"></span>项目参与企业总数（组织单位填报）：</td>
		<td nowrap colspan="2">
			<input name="proposal/org_counts" id="org_counts" label="项目参与企业总数" type="text" onfocus="InitInput.setNumber(this,7,0,0)"
				class="input_css" style="text-align:right;width: 130px;" maxlength="50"
				value="<x:out select="$xmlData/data/proposal/org_counts" />" />&nbsp;家
		</td>
   </tr>
    
	<tr>
		<td nowrap align="right" width="20%"><span class="color_red">*</span>项目联系人：</td>
		<td nowrap width="20%"><input id="contact_psn_cname"
			name="proposal/contact_psn_cname" label="项目联系人" type="text" required
			class="input_css required "  
			maxlength="50"
			value="<x:out select="$xmlData/data/proposal/contact_psn_cname" />" />
		</td>
		<td nowrap align="right" width="10%"><span class="color_red">*</span>联系电话：</td>
		<td nowrap width="20%"><input id="contact_psn_tel"
			name="proposal/contact_psn_tel" label="联系电话" type="text" required
			class="input_css required"  maxlength="20"
			value="<x:out select="$xmlData/data/proposal/contact_psn_tel" />" />
		</td>
		<td nowrap align="right" width="10%"><span class="color_red">*</span>手机：</td>
		<td nowrap colspan="1" width="20%"><input id="contact_psn_mobile"
			name="proposal/contact_psn_mobile" label="手机" type="text" required
			class="input_css required mobile"  maxlength="11"  
			value="<x:out select="$xmlData/data/proposal/contact_psn_mobile" />" />
		</td>
	</tr>
	
	<!-- add -->
	
	<tr id="fzr">
	    <security:authorize ifAnyGranted="A_DAILU_PROPOSAL">
	    <td align="right">申报人：</td>
		<td nowrap>
		<input type="text" disabled="disabled" name="proposal/sbr_cname" label="申报人"  class="input_css required maxlength:100" value="<x:out select="$xmlData/data/proposal/sbr_cname"/>" maxlength="100"/>
		<input type='hidden' name='sbr_cname' value="<x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/basic_info/zh_name" />" />
	
		<security:authorize ifAnyGranted="A_DAILU_PROPOSAL">
				<span id="personSelect">
				<input type="button" class="button_02" style="height: 25px; padding: 1px;" id="selectPsn" value="更改">
				<cpt:personSelect key="personSelect" addRole="3" callback="selectPsnCall" bindEvent="click" bindObject="selectPsn" title="设置申报人" fltFile="personSelector.ftl"></cpt:personSelect>
				</span>
		</security:authorize>
		</td>
		<td align="right">职务：</td>
		<td >
		<input type='text' name='proposal/sbr_post' class='required' maxlength='50' label='职务' value="<x:out select="$xmlData/data/proposal/sbr_post"/>"/>
	    <input type='hidden' name='sbr_post' value='<x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/basic_info/position" />' />
		</td>
		<td align="right" >手机：</td>
		<td  colspan="3"> 
		<input type='text' name='proposal/sbr_mobile' class='required mobile' maxlength='11' onfocus="InitInput.setNumber(this,11,0,0)" label='手机' value="<x:out select="$xmlData/data/proposal/sbr_mobile"/>" />
	    <input type='hidden' name='sbr_mobile' value='<x:out select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/contact/mobile" />' />
		</td>
	</security:authorize>
	<security:authorize ifNotGranted="A_DAILU_PROPOSAL">
		<td align="right" width="10%">申报人：</td>
		<td width="20%"><span name="proposal/sbr_cname"> <x:out
					select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/basic_info/zh_name" />
		</span>&nbsp;</td>
		<td align="right" width="10%">职务：</td>
		<td width="20%"><span name="proposal/sbr_post"><x:out
					select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/basic_info/position" />
		</span>&nbsp;</td>
		<td align="right" width="10%">手机：</td>
		<td width="20%"><span name="proposal/sbr_mobile"><x:out
					select="$xmlData/data/zh_persons/zh_person[@submit_psn='1']/contact/mobile" />
		</span>&nbsp;</td>
		</security:authorize>
	</tr>
	<tr>
		<td colspan="6" class="t_bar">&nbsp;<span class="color_red">*</span>项目总结（字数不少于2000：1、该项目的主要内容；2、开展该项目的目的和意义；3、项目取得的成果）</td>
	</tr>
	<tr>
		<td colspan="6"><textarea id="brief" name="proposal/brief" rows='7' cols='180' class="required textarea minlength:2000" label="项目总结"><x:out select="$xmlData/data/proposal/brief" /></textarea>
		                <input type="hidden" name="proposal/brief_hidden" value="">
		</td>
	</tr>
	
</table>
<script type="text/javascript">
$("#attendway").change(function(){
	checkNeedArea('attendway');
});
function checkNeedArea(Id) {
		var valueArea = $('#'+Id).val();
		if(valueArea == 1){
			//组织单位
			$("#org_counts").attr("disabled",false);
			$("#org_counts").addClass("required");
			$("#need_req").text("*");
			$("#content_need").text("*");
			//联动经费信息
			$("#cascade1").show();
			$("#cascade2").hide();
			$("#berif9").text("是");
			$("#berif11").text("是");
			
		} else if(valueArea == 2){
			//参与单位
			$("#org_counts").attr("disabled",true);
			$("#org_counts").removeClass("required");
			$("#org_counts").val("");
			$("#need_req").text("");
			$("#content_need").text("");
			//联动经费信息
			$("#cascade1").hide();
			$("#cascade2").show();
			$("#berif9").text("否");
			$("#berif11").text("否");
		} else {
			//不选
			$("#org_counts").attr("disabled",true);
			$("#org_counts").removeClass("required");
			$("#org_counts").val("");
			$("#need_req").text("");
			$("#content_need").text("");
			//联动经费信息
			$("#cascade1").hide();
			$("#cascade2").hide();
			$("#berif9").text("否");
			$("#berif11").text("否");
		}
	}
$(function() {
	checkNeedArea('attendway_value');
	//初始化人员信息
	initPersonValue("fzr");
});

	//basic_info/position
	function selectPsnCall(data) {
	$("input[name$='psn_code']").val(data.person.psnCode);
	$("#fzr").find("input[name$='sbr_cname']").val(data.person.zhName);
	$("#fzr").find("input[name$='sbr_post']").val(data.personExtend.basic_info.position);
	$("#fzr").find("input[name$='sbr_mobile']").val(data.personExtend.contact.mobile);
	tb_remove2();
	}   
function initPersonValue(tblName){
	 var tbl = $("#" + tblName);
	
	 tbl.find("input[type=hidden]").each(function(){
		var id=$(this).attr("name");
		
		if(id==null || id=="")
			return true;
		var parentObj=tbl.find("[name$='/"+id+"']");
		
		if(parentObj.val() == null || $.trim(parentObj.val()) == ""){
			var value= $(this).val();
			parentObj.val(value);
		}
	
});
 
}
</script>